package cn.lxh.remote.fallback;

import cn.lxh.remote.api.LoginFeignApi;
import cn.lxh.remote.pojo.bo.CreateLoginBo;
import cn.lxh.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author lxh Create Time: 2023/12/23 17:05
 * LoginFeignApiFallbackFactory熔断降级处理方案类
 */
@Component
public class LoginFeignApiFallbackFactory implements FallbackFactory<LoginFeignApi> {
    @Override
    public LoginFeignApi create(Throwable cause) {
        return new LoginFeignApi() {
            @Override
            public JSONResult create(CreateLoginBo createLoginBo) {
                cause.printStackTrace();
                return JSONResult.error();
            }
        };
    }
}
